import { PureComponent } from 'react';
import './index.less'
import Lazyimg from 'react-lazyimg-component';
import loadingpng from '@/assets/loading.png';
import WithRouter from '@/router/WithRouter'
class GoodsItem extends PureComponent {
  render() {
    let { item } = this.props;
    return (
      <div className="goods_item" onClick={()=>this.goInfo(item.id)}>
        <Lazyimg className="lazy" src={item.image} placeholder={<img src={loadingpng} alt='加载失败' />} />
        <div className="info">
          <div className="name">{item.storeName}</div>
          <div className="oldprice">¥{item.otPrice}</div>
          <div className="price">¥{item.price}</div>
        </div>
      </div>
    )
  }
  goInfo(id){
    // 跳转到详情页
     this.props.router.navigate(`/info/${id}`)
  }
}
export default WithRouter(GoodsItem);